package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.EditNcBean;
import com.lwj.liwanjia.impl.EditNcView;
import com.lwj.liwanjia.model.EditNcModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/27.
 */

public class EditNcPresenter {
    private EditNcView editNcView;
    private EditNcModel editNcModel;

    public EditNcPresenter(EditNcView editNcView) {
        this.editNcView = editNcView;
        editNcModel = new EditNcModel();
    }

    public void EditNc(String token, String nick) {
        if (editNcView != null) {
            editNcModel.editNc(token, nick, new Subscriber<EditNcBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    editNcView.showError((Exception) e);
                }

                @Override
                public void onNext(EditNcBean editNcBean) {
                    editNcView.editNc(editNcBean);
                }
            });
        }
    }
}
